<?php

namespace app\miniprogram\controller;

class UserWallet extends Base {
	protected $process = 'UserWallet';
	protected $noNeedLogin = ['balance_order_notify'];

	//获取钱包信息
	public function index() {
		$this->ajax_process(function($process) {
        	return $process->index(); 
        });
	}

	//余额充值订单
	public function balance_order() {
		$this->ajax_process(function($process) {
			return $process->balance_order();
		});
	}

	//余额充值支付
	public function balance_order_pay() {
		$this->ajax_process(function($process) {
			return $process->balance_order_pay();
		});
	}

	//余额充值回调
	public function balance_order_notify() {
		$app = loadTool('Wechat')->payment('miniprogram2');
	    $response = $this->ajax_process(function($process, $user) use ($app){
    		return $process->balance_order_notify($app);
    	}, null, true);
	    return $response;
	}

	//获取余额充值订单列表
	public function balance_order_private_list() {
		$this->ajax_process(function($process) {
			return $process->balance_order_private_list();
		});
	}

	//获取余额变动列表
	public function user_wallet_balance_log() {
		$this->ajax_process(function($process) {
			return $process->user_wallet_balance_log();
		});
	}

	//申请余额充值退款
	public function user_wallet_balance_refund() {
		$this->ajax_process(function($process) {
			return $process->user_wallet_balance_refund();
		});
	}

	//取消余额充值退款
	public function cancel_balance_refund() {
		$this->ajax_process(function($process) {
			return $process->cancel_balance_refund();
		});
	}
}
